Skip to content

Comments

feat: add canonical url meta tag for docs pages#469

Open
TaranaKhanna wants to merge 1 commit intov0-2from
feat/add-canonical-url-meta-tag
Open

feat: add canonical url meta tag for docs pages#469
TaranaKhanna wants to merge 1 commit intov0-2from
feat/add-canonical-url-meta-tag

Conversation

@TaranaKhanna
Copy link

@TaranaKhanna TaranaKhanna commented Feb 14, 2026

fixes: issue #430

Summary by CodeRabbit

Release Notes

Chores

  • Added canonical URLs to documentation pages across API Reference, Developing, Guide, Platform, Self-Hosting, and Site Policy sections. This improves search engine optimization and helps prevent duplicate content indexing issues across different documentation URLs.
  • Set global metadata base URL to establish a consistent primary domain reference for all documentation pages throughout the site.

@github-actions
Copy link

github-actions bot commented Feb 14, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai
Copy link

coderabbitai bot commented Feb 14, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'path_filters'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

The PR adds canonical URL metadata properties across six dynamic documentation route pages and establishes a metadataBase URL in the root layout configuration. Each dynamic page now constructs its canonical URL from the slug parameters, while the layout sets the base URL for relative canonical references.

Changes

Cohort / File(s) Summary
Dynamic Route Canonical URLs
src/app/api-reference/[[...slug]]/page.tsx, src/app/developing/[[...slug]]/page.tsx, src/app/guide/[[...slug]]/page.tsx, src/app/platform/[[...slug]]/page.tsx, src/app/self-hosting/[[...slug]]/page.tsx, src/app/site-policy/[[...slug]]/page.tsx
Added alternates.canonical field to generateMetadata return value, constructing canonical URL from slug parameters to prevent duplicate content issues.
Root Metadata Configuration
src/app/layout.tsx
Added metadataBase property to the metadata object with URL https://docs.logchimp.codecarrot.net as the base for relative canonical URLs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • feat: re-structure docs #401: Implements the initial generateMetadata functions for dynamic route pages that are being extended with canonical URL support in this PR.
🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add canonical url meta tag for docs pages' accurately describes the main change: adding canonical URL meta tags to documentation pages across multiple route files.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into v0-2

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-canonical-url-meta-tag

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/app/platform/`[[...slug]]/page.tsx:
- Around line 44-46: The alternates.canonical value currently builds
`/platform/${params.slug?.join("/") ?? ""}` which yields a trailing slash when
params.slug is undefined; update the logic in the page component so canonical is
`/platform` for the index and `/platform/<joined-slug>` for subpages (e.g., use
a conditional on params.slug or trim the final slash) — apply the same change to
the other five page files that use the same pattern; target the
alternates.canonical assignment and the params.slug usage to make this change.

Comment on lines +44 to +46
alternates: {
canonical: `/platform/${params.slug?.join("/") ?? ""}`,
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Trailing slash on index pages.

When params.slug is undefined (the index route), this produces /platform/ (with a trailing slash), whereas sub-pages get /platform/setup (no trailing slash). This inconsistency can cause search engines to treat them as different URLs.

Consider trimming the trailing slash:

Proposed fix
    alternates: {
-     canonical: `/platform/${params.slug?.join("/") ?? ""}`,
+     canonical: params.slug ? `/platform/${params.slug.join("/")}` : "/platform",
    },

The same pattern applies to all six page files in this PR.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
alternates: {
canonical: `/platform/${params.slug?.join("/") ?? ""}`,
},
alternates: {
canonical: params.slug ? `/platform/${params.slug.join("/")}` : "/platform",
},
🤖 Prompt for AI Agents
In `@src/app/platform/`[[...slug]]/page.tsx around lines 44 - 46, The
alternates.canonical value currently builds `/platform/${params.slug?.join("/")
?? ""}` which yields a trailing slash when params.slug is undefined; update the
logic in the page component so canonical is `/platform` for the index and
`/platform/<joined-slug>` for subpages (e.g., use a conditional on params.slug
or trim the final slash) — apply the same change to the other five page files
that use the same pattern; target the alternates.canonical assignment and the
params.slug usage to make this change.

@TaranaKhanna
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@TaranaKhanna
Copy link
Author

Ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant